﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SelfMadeMillionaire.Core.Repositories;
using SelfMadeMillionaire.Core.Services;

namespace SelfMadeMillionaire.BLL.Services
{
    public class PromotionService : IPromotionService
    {
        private readonly IPromotionRepository _promotionRepository;

        public PromotionService(IPromotionRepository promotionRepository)
        {
            _promotionRepository = promotionRepository;
        }

        public IEnumerable<Core.Entities.Promotion> GetAll()
        {
            var prom = _promotionRepository.GetAll();
            return prom;
        }

        public Core.Entities.Promotion Add(Core.Entities.Promotion promotion)
        {
            var prom = _promotionRepository.Add(promotion);
            return prom;
        }

        public Core.Entities.Promotion Update(Core.Entities.Promotion promotion)
        {
            var prom = _promotionRepository.Update(promotion);
            return prom;
        }

        public Core.Entities.Promotion Get(int id)
        {
            var prom = _promotionRepository.Get(id);
            return prom;
        }

        public void Remove(int id)
        {
            _promotionRepository.Remove(id);
        }


        public Core.Entities.Promotion GetPromoByCode(string promocode)
        {
            var prom = _promotionRepository.GetPromoByCode(promocode);
            return prom;
        }
    }
}
